1. Field of the Invention
The present invention relates to a microcomputer having a storage means that is divided into a plurality of storage areas, and an electrical device having the same.
2. Description of the Related Art
Various prior art electrical devices have a microcomputer and operate by programs stored in a storage unit of the microcomputer, such as a read only memory (ROM). The control system of the microcomputer includes a unit for determining and performing the entire control operation of a device loaded with the microcomputer and a driver unit for controlling various actuators of the device in accordance with the contents of the determined operation. If the actuators are a simple relay and switch, the driver unit can easily be configured. In order to drive, e.g., a DC motor having a large capacity, however, a great load is applied to the driver unit and large programs are required for doing so.
For example, an air conditioning system includes a device control microcomputer (control MCU) for determining the number of revolutions of a motor and a motor drive microcomputer (drive MCU) for driving the motor in accordance with the contents of operations determined by the control MCU. These microcomputers are each formed of a single chip. The chip includes a ROM for storing programs and data, a RAM for temporarily storing data and a CPU for executing the programs and processing the data.
The ROM of the motor drive microcomputer stores programs in which algorithm necessary for driving the motor is described. The ROM of the device control microcomputer stores programs necessary for controlling the device. These microcomputers are connected to each other via a communication line. The device control microcomputer gives an instruction on the number of revolutions of the motor to the motor drive microcomputer. The motor drive microcomputer transmits data of the actual number of revolutions of the motor to the device control microcomputer.
In the foregoing system, instructions and responses are simply communicated between the microcomputers in accordance with a communication protocol. The programs stored in the ROMs of the microcomputers are executed only in their respective microcomputers. In other words, one of the microcomputers cannot gain access to the ROM of the other microcomputer. The contents of the programs of the microcomputers are not revealed to each other but protected confidentially. However, this system requires two microcomputers and thus increases in size.
If one microcomputer can both drive a motor and control a device, various merits such as device downsizing and cost reduction can be obtained. It can thus be thought to use one microcomputer whose ROM stores both programs for driving a motor and controlling a device. However, there occurs a problem that access can be gained to all the programs stored in the ROM. Even though a motor drive program and a device control program are created by different companies, the programs each can be read out of both the companies and thus cannot be protected confidentially from each other.
On the other hand, there is a microcomputer having a CPU and an external device one of which selectively has priority regarding the bus right of a data bus and an address bus of a memory. When the external device has the bus right, the memory can include an inhibit area (address) for inhibiting the external device from reading data out of the memory and writing data thereto (see, for example, Jpn. Pat. Appln. KOKAI Publication No. 11-110294). When the external device has the bus right, no access can be gained to a specific area in the memory to inhibit data from being read or written. Thus, the external device is inhibited from reading data out of the specific area, thereby ensuring the confidentiality of data and programs.
In the microcomputer that is so configured that the external device has the bus right, the external device can be inhibited from gaining access to the memory of the microcomputer. However, it is not taken into consideration how the confidentiality of programs stored in the memory is secured.
It can thus be thought to use a microcomputer with a memory that is divided into a plurality of storage areas. The microcomputer has a function of inhibiting data from being read out of the storage areas in response to access between them. With this microcomputer, a program created by a programmer of a company and then stored in a given storage area of a ROM cannot be read out by that of another company who creates a program to be stored in another storage area of the ROM. The confidentiality of the programs stored in the same ROM can thus be protected from each other.
In a microcomputer as described above, however, in order to execute a program stored in a given storage area of a memory and a program stored in another storage area thereof in association with each other, the address of each of the programs (the address in which an instruction to be executed first is stored) has to be made open to the programmers of both the programs in advance. More specifically, when a first program created by one programmer invokes a second program created by another programmer, an address necessary for invoking the second program can be designated and called. However, when a plurality of functions are created in the second program as different subroutines, the programmer of the first program has to be notified of the initial address of each of the subroutines in advance.
When the first and second programs are created at the same time, the initial address of each of the subroutines in the second program may change to a new address. If the address changes to a new address, the programmer of the first program has to be notified of the change. The programmer of the first program has to change an address to be called in the first program whenever the programmer of the second program changes the initial address of a subroutine. He or she therefore has to perform a complicated operation. If the programmer forgets to change an address to be called, there is a possibility that abnormal control will be performed.